package com.example.dense_rack_server.mapper;

import com.example.dense_rack_server.entity.MyDept;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.dense_rack_server.entityVo.MenuALLVo;
import com.example.dense_rack_server.entityVo.MyDeptTreeVo;
import io.swagger.annotations.ApiParam;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 部门表 Mapper 接口
 * </p>
 *
 * @author 张彬
 * @since 2025-03-03
 */
public interface MyDeptMapper extends BaseMapper<MyDept> {

    List<MyDept> selectDeptTree(@ApiParam(value = "deptId") int deptId);

    List<MyDept> selectdepttreeDoesNotIncludeItself(@ApiParam(value = "deptId") int deptId);

    /**
     * 绘制部门树(用户管理使用)
     */
    @Select("select d.dept_id as id,d.parent_id as parentId ,d.dept_name as title from my_dept as d")
    List<MyDeptTreeVo> buildDept();

    /**
     * 绘制部门树
     */
    @Select("select d.dept_id as id,d.parent_id,d.dept_name as title from my_dept as d")
    List<MenuALLVo> buildDeptAll();

    /**
     * 部门详情
     */
    Map<String, Object> getDeptDetail(String deptId);
}
